import os
import numpy as np
from tqdm import tqdm
import matplotlib.pyplot as plt

histogram_data = np.zeros(200)
Path_TSRIMG = r'J:\路测视频\G410\G410D-1207\1207-2\20211207img\20211207img\tsr'
for root, dirs, files in os.walk(Path_TSRIMG):
    for file in tqdm(files):
        if int(file.split("_")[1]) != 3000:
            w = int(file.split("_")[7].split("-")[2])
            if w < 200:
                histogram_data[w] += 1
# plt.hist(x = histogram_data, # 指定绘图数据
#          bins = 200, # 指定直方图中条块的个数
#         color = 'steelblue', # 指定直方图的填充色
#          edgecolor = 'black' # 指定直方图的边框色
#          )
plt.plot(range(200), histogram_data)
plt.show()